﻿/** 
 * Copyright / Licence
 * <p>
 * You are free:
 * <li>to Share — to copy, distribute and transmit the work
 * <li>to Remix — to adapt the work
 * </p>
 * <p>
 * Under the following conditions:
 * <li>Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
 * <li>Noncommercial — You may not use this work for commercial purposes.
 * <li>Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
 * </p>
 * <p>
 * More information can be found here:
 * <br/>
 * http://creativecommons.org/licenses/by-nc-sa/3.0/
 * </p>
 * <p>
 * Please contact Manfred Weber [manfred.weber@gmail.com] if you require a commercial licence
 * </p>
 */
 package org.dschini.ui.maps.world {

	import flash.events.*;
	import flash.display.*;
	import org.dschini.data.ui.maps.*;
	import org.dschini.data.ui.maps.world.*;
	import org.dschini.data.ui.maps.world.europe.*;
	import org.dschini.ui.maps.*;
	import org.dschini.ui.maps.world.*;
	import org.dschini.ui.maps.world.europe.*;

	public class EuropeMap extends Map
	{
		public var europeMapCountryLines:MovieClip;
		
		public var spainMap:SpainMap;
		public var franceMap:FranceMap;
		public var germanyMap:GermanyMap
		public var irelandMap:IrelandMap;
		public var northernIrelandMap:NorthernIrelandMap;
		public var icelandMap:IcelandMap;
		public var ukMap:UkMap;
		public var faroeIslandsMap:FaroeIslandsMap;
		public var portugalMap:PortugalMap;
		public var italyMap:ItalyMap;
		public var switzerlandMap:SwitzerlandMap;
		public var denmarkMap:DenmarkMap;
		public var austriaMap:AustriaMap;
		public var sloveniaMap:SloveniaMap;
		public var croatiaMap:CroatiaMap;
		public var montenegroMap:MontenegroMap;
		public var albaniaMap:AlbaniaMap;
		public var greeceMap:GreeceMap;
		public var westTurkeyMap:WestTurkeyMap;
		public var macedoniaMap:MacedoniaMap;
		public var bulgariaMap:BulgariaMap;
		public var bosniaAndHerzegovinaMap:BosniaAndHerzegovinaMap;
		public var serbiaMap:SerbiaMap;
		public var romaniaMap:RomaniaMap;
		public var moldovaMap:MoldovaMap;
		public var ukraineMap:UkraineMap;
		public var westKazakhstanMap:WestKazakhstanMap;
		public var westRussiaMap:WestRussiaMap;
		public var belarusMap:BelarusMap;
		public var hungaryMap:HungaryMap;
		public var slovakiaMap:SlovakiaMap;
		public var czechRepublicMap:CzechRepublicMap;
		public var luxembourgMap:LuxembourgMap;
		public var belgiumMap:BelgiumMap;
		public var netherlandsMap:NetherlandsMap;
		public var polandMap:PolandMap;
		public var lithuaniaMap:LithuaniaMap;
		public var latviaMap:LatviaMap;
		public var estoniaMap:EstoniaMap;
		public var norwayMap:NorwayMap;
		public var swedenMap:SwedenMap;
		public var finlandMap:FinlandMap;
		public var svalbardMap:SvalbardMap;

		public function EuropeMap():void
		{
			countries = [
				spainMap,
				franceMap,
				germanyMap,
				irelandMap,
				northernIrelandMap,
				icelandMap,
				ukMap,
				faroeIslandsMap,
				portugalMap,
				italyMap,
				switzerlandMap,
				denmarkMap,
				austriaMap,
				sloveniaMap,
				croatiaMap,
				montenegroMap,
				albaniaMap,
				greeceMap,
				westTurkeyMap,
				macedoniaMap,
				bulgariaMap,
				bosniaAndHerzegovinaMap,
				serbiaMap,
				romaniaMap,
				moldovaMap,
				ukraineMap,
				westKazakhstanMap,
				westRussiaMap,
				belarusMap,
				hungaryMap,
				slovakiaMap,
				czechRepublicMap,
				luxembourgMap,
				belgiumMap,
				netherlandsMap,
				polandMap,
				lithuaniaMap,
				latviaMap,
				estoniaMap,
				norwayMap,
				swedenMap,
				finlandMap,
				svalbardMap
			]
		}
		
		override public function set mouseEnabled( mouseEnabled:Boolean ):void
		{
			super.mouseEnabled = mouseEnabled;
			for(var i:int=0; i<countries.length; i++){
				Map(countries[i]).mouseEnabled = mouseEnabled;
			}
		}
		
		override public function set doubleClickEnabled( doubleClickEnabled:Boolean ):void
		{
			super.doubleClickEnabled = doubleClickEnabled;
			for(var i:int=0; i<countries.length; i++){
				Map(countries[i]).doubleClickEnabled = doubleClickEnabled;
			}
		}
		
		override public function set data( data:MapData ):void
		{
			_data = data;
			for(var i:int=0; i<countries.length; i++){
				countries[i].data = MapData(_data).countries[i];
			}
		}
		
		override public function render():void
		{
			europeMapCountryLines.visible = data.countryLinesVisible ? true : false;
			if( data.countryLinesColorTransform ){
				europeMapCountryLines.transform.colorTransform = data.countryLinesColorTransform;
			}
			for(var i:int=0; i<countries.length; i++){
				countries[i].render();
			}
		}
	}
}
